package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Vector3D;
	import flash.text.TextField;
	import flash.utils.Timer;
	import flash.utils.getTimer;
	
	
	public class isotest extends Sprite
	{
		public function isotest()
		{
			stage.frameRate = 60;
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			Globals.rendererFactory = new RendererFactory(RendererFactory.RENDER_TYPE_ND2D);
			Globals.lastTime = Globals.currentTime = getTimer();
			var cfg:WorldConfig = new WorldConfig();
			cfg.renderStyle = WorldConfig.RENDER_STYLE_ISOMETRIC;
			cfg.renderStyle = WorldConfig.RENDER_STYLE_SIMPLE_GRID;
			var world:World = new World();
			world.configure(cfg);
			
			
			var i:int, il:int, j:int, jl:int, k:int, kl:int;

			world.setParent(this);
			var profile:TextField = new TextField();
			profile.textColor = 0xff0000;
			profile.width = 100;
			addChild(profile);
			addEventListener(Event.ENTER_FRAME, function(e:Event):void{
				Globals.currentTime = getTimer();
				Globals.deltaTime = Globals.currentTime - Globals.lastTime;
				world.update();
				profile.text = String( Math.floor(1000 / Globals.deltaTime) );
				
				Globals.lastTime = Globals.currentTime;
			});
			
			stage.addEventListener(MouseEvent.CLICK, function(me:MouseEvent):void{
				for(var n:int = 0; n < 500; n++){
				var gobj:GameObject = new GameObject();
				gobj.setPosition(new Vector3D(0,0,0));
				world.add(gobj);				
				}
			});
			
		
			
		}
	}
}